# befriend
# conquer
# antagonize
# build_ship
# build_army
# unit_ratio
# build_building
# research_tech
# garrison
# protect
# influence
# contain
# area_priority
# building_target


GER_unit_production = {
	allowed = {
		original_tag = GER
	}
	enable = {
		always = yes
	}
	abort = {
		always = no
	}

	ai_strategy = {
		type = role_ratio
		id = garrison
		value = 4
	}

	# Old garrison system against resistance
	# ai_strategy = {
	# 	type = role_ratio
	# 	id = suppression
	# 	value = 6
	# }

	ai_strategy = {
		type = role_ratio
		id = paratroopers
		value = 0
	}

	ai_strategy = {
		type = role_ratio
		id = mountaineers
		value = 2
	}

	ai_strategy = {
		type = role_ratio
		id = marines
		value = 0
	}

	ai_strategy = {
		type = role_ratio
		id = cavalry
		value = -100
	}

	ai_strategy = {
		type = role_ratio
		id = motorized
		value = 0 #because doctrine this = 2
	}

	ai_strategy = {
		type = role_ratio
		id = mechanized
		value = -5 #because doctrine this = 0
	}

	ai_strategy = {
		type = role_ratio
		id = armor
		value = -17 #because doctrine this = 3
	}

	ai_strategy = {
		type = role_ratio
		id = infantry
		value = 75 #88 to 70
	}

	#Air unit factors
	ai_strategy = {
		type = unit_ratio
		id = fighter
		value = 100
	}

	ai_strategy = {
		type = unit_ratio
		id = cas
		value = -35 #because doctrine this = 15
	}

	ai_strategy = {
		type = unit_ratio
		id = tactical_bomber
		value = -40
	}

	ai_strategy = {
		type = unit_ratio
		id = strategic_bomber
		value = -10
	}

	ai_strategy = {
		type = unit_ratio
		id = naval_bomber
		value = 5
	}


	# Naval unit factors
	ai_strategy = {
		type = unit_ratio
		id = capital_ship
		value = 15
	}

	ai_strategy = {
		type = unit_ratio
		id = submarine
		value = -50 #because doctrine this = 50
	}

	ai_strategy = {
		type = unit_ratio
		id = screen_ship
		value = 20
	}

	ai_strategy = {
		type = unit_ratio
		id = convoy
		value = 20
	}

	ai_strategy = {
		type = equipment_production_factor
		id = fighter
		value = 150
	}

	ai_strategy = {
		type = equipment_production_factor
		id = cas
		value = -65
	}

	ai_strategy = {
		type = equipment_production_factor
		id = tactical_bomber
		value = -80
	}

	ai_strategy = {
		type = equipment_production_factor
		id = naval_bomber
		value = -120
	}

	ai_strategy = {
		type = equipment_production_factor
		id = strategic_bomber
		value = -200
	}

	ai_strategy = {
		type = equipment_production_factor
		id = infantry
		value = 11 #30 to 50
	}

	ai_strategy = {
		type = equipment_production_factor
		id = anti_tank
		value = 20
	}

	ai_strategy = {
		type = equipment_production_factor
		id = anti_air
		value = 25
	}

	ai_strategy = {
		type = equipment_production_factor
		id = artillery
		value = 100 #20 to 40
	}

	ai_strategy = {
		type = equipment_production_factor
		id = armor
		value = -10
	}
	ai_strategy = {
		type = equipment_production_factor
		id = motorized
		value = -10
	}
	ai_strategy = {
		type = equipment_production_min_factories #Build these up over time, don't stall
		id = anti_air
		value = 2
	}
	ai_strategy = {
		type = equipment_production_min_factories
		id = artillery
		value = 4
	}
	ai_strategy = {
		type = equipment_production_min_factories
		id = fighter
		value = 4
	}
	ai_strategy = {
		type = equipment_variant_production_factor
		id = strat_bomber_equipment
		value = -100
	}
	ai_strategy = {
		type = equipment_variant_production_factor
		id = support_equipment
		value = 30
	}

	ai_strategy = { #added to railway gun define (set to 0 by default, increased in default strategies)
		type = railway_gun_divisions_ratio
		value = 1
	}
}

GER_anti_armor = {
	allowed = {
		original_tag = GER
	}
	enable = {
		ai_wants_divisions > 5 #Decreasing the amount of motorized the AI wants

		any_enemy_country = {
			ROOT = {
				estimated_intel_max_armor = {
					tag = PREV
					value > 25
				}
			}
		}
	}
	abort = {
		ai_wants_divisions < 6 #Decreasing the amount of motorized the AI wants
	}

	ai_strategy = {
		type = role_ratio
		id = motorized
		value = 15
	}
}

GER_armored_production = {
	allowed = {
		original_tag = GER
	}
	enable = {
		date > 1939.1.1
		ai_wants_divisions > 24 #Decreasing the amount of tanks the AI wants
	}
	abort = {
		ai_wants_divisions < 25 #Decreasing the amount of tanks the AI wants
	}

	ai_strategy = {
		type = role_ratio
		id = armor
		value = 9
	}
}

GER_halt_light_armor_production_in_transitioning = {
	allowed = {
		original_tag = GER
	}
	enable = {
		has_template_majority_unit = medium_armor
		OR = {
			has_equipment = { light_tank_chassis > 600 }
			date > 1939.1.1
		}
	}
	abort = {
		# once we start we never go back to light armor
	}

	ai_strategy = {
		type = equipment_variant_production_factor
		id = light_tank_chassis
		value = -100
	}
}

GER_stockpile_less_early_game = {
	allowed = {
		original_tag = GER
	}

	enable = {
		date < 1940.1.1
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = equipment_stockpile_surplus_ratio
		value = -20 # reduce while we build up in case of CZE or Austria issues
	}
}


GER_highered_armored_production = {
	allowed = {
		original_tag = GER
	}
	enable = {
		num_of_military_factories > 109
	}
	abort = {
		num_of_military_factories < 110
	}

	ai_strategy = {
		type = role_ratio
		id = armor
		value = 20
	}
}

GER_dont_waste_xp_until_medium_armor = {
	allowed = {
		original_tag = GER
	}
	enable = {
		always = yes
	}
	abort = {
		has_template_majority_unit = medium_armor
	}

	ai_strategy = {
		type = template_prio
		id = paratrooper
		value = -100
	}

	ai_strategy = {
		type = template_prio
		id = mountaineers
		value = -100
	}
}

GER_super_boost_light_for_med_armor = {
	allowed = {
		original_tag = GER
	}
	enable = {
		OR = {
			has_tech = basic_medium_tank
			has_tech = basic_medium_tank_chassis
		}
		NOT = { has_template_ai_majority_unit = medium_armor }
	}

	abort = {
		has_template_ai_majority_unit = medium_armor
	}

	# lets do changes more often during this period too
	ai_strategy = {
		type = land_xp_spend_priority
		id = division_template
		value = 100
	}

	# this is gateway
	ai_strategy = {
		type = template_prio
		id = light_armor
		value = 100
	}

	ai_strategy = {
		type = template_prio
		id = medium_armor
		value = 150
	}

	# Germany is set up to change their SS division into medium armor.
	ai_strategy = {
		type = template_prio
		id = motorized
		value = 200
	}
}

GER_super_boost_light_for_modern_armor = {
	allowed = {
		original_tag = GER
	}
	enable = {
		OR = {
			has_tech = main_battle_tank
			has_tech = main_battle_tank_chassis
		}
		NOT = { has_template_ai_majority_unit = modern_armor }
	}

	abort = {
		has_template_ai_majority_unit = modern_armor
	}

	# lets do changes more often during this period too
	ai_strategy = {
		type = land_xp_spend_priority
		id = division_template
		value = 100
	}

	# this is gateway
	ai_strategy = {
		type = template_prio
		id = medium_armor
		value = 100
	}

	ai_strategy = {
		type = template_prio
		id = modern_armor
		value = 150
	}
}


GER_template_design = {
	allowed = {
		original_tag = GER
	}
	enable = {
		date < 1940.1.1
	}
	abort = {
		date > 1940.1.1
	}

	ai_strategy = {
		type = template_prio
		id = infantry
		value = 20
	}

	ai_strategy = {
		type = template_prio
		id = artillery
		value = 20
	}

	ai_strategy = {
		type = template_prio
		id = motorized
		value = -50
	}

	ai_strategy = {
		type = template_prio
		id = cavalry
		value = -100
	}

	ai_strategy = {
		type = template_prio
		id = light_armor
		value = 30
	}

	ai_strategy = {
		type = template_prio
		id = heavy_armor
		value = -50
	}

	ai_strategy = {
		type = template_prio
		id = paratroopers
		value = -50
	}
}

war_with_poland = {
	allowed = {
		original_tag = GER
	}
	enable = {
		has_completed_focus = GER_demand_memel
		country_exists = POL
	}
	abort = {
		NOT = { country_exists = POL }
	}

	ai_strategy = {
		type = antagonize
		id = "POL"
		value = 200
	}
}

danzig_of_war_preparation = {
	allowed = {
		original_tag = GER
	}
	enable = {
		focus_progress = {
			focus = GER_danzig_or_war
			progress > 0.01
		}
		NOT = {
			has_completed_focus = GER_danzig_or_war
			owns_state = 85
		}
		country_exists = POL
	}

	abort = {
		OR = {
			NOT = { country_exists = POL }

			AND = {
				has_completed_focus = GER_danzig_or_war
				GER = { has_war_with = POL }
			}

			owns_state = 85
		}
	}

	ai_strategy = {
		type = conquer
		id = "POL"
		value = 100
	}
}

dont_die_in_mountains = {
	allowed = {
		original_tag = GER
	}
	enable = {
		date < 1942.5.1
		country_exists = SWI
		country_exists = FRA
	}
	abort = {
		NOT = { country_exists = FRA }
		date > 1942.5.1
	}

	ai_strategy = {
		type = ignore
		id = "SWI"
		value = 100
	}
}

war_with_soviets = {
	allowed = {
		original_tag = GER
	}
	enable = {
		has_completed_focus = GER_ussr_war_goal
		country_exists = SOV
	}
	abort = {
		NOT = { country_exists = SOV }
	}


	ai_strategy = {
		type = antagonize
		id = "SOU" # Yes, SOU is deliberate
		value = 200
	}
}

soviet_ally = {
	allowed = {
		original_tag = GER
	}
	enable = {
		has_completed_focus = GER_soviet_ally
		country_exists = SOV
	}
	abort = {
		NOT = { country_exists = SOV }
	}

	ai_strategy = {
		type = befriend
		id = "SOV"
		value = 200
	}
	ai_strategy = {
		type = alliance
		id = "SOV"
		value = 200
	}
}


italy_ally = {
	allowed = {
		original_tag = GER
	}
	enable = {
		has_completed_focus = GER_italy_ally
		country_exists = ITA
	}
	abort = {
		NOT = { country_exists = ITA }
	}

	ai_strategy = {
		type = befriend
		id = "ITA"
		value = 200
	}
	ai_strategy = {
		type = alliance
		id = "ITA"
		value = 200
	}
}

iron_pact_italy = {
	allowed = {
		original_tag = GER
	}
	enable = {
		ITA = {
			has_completed_focus = ITA_pact_of_steel
			exists = yes
		}
	}
	abort = {
		NOT = { country_exists = ITA }
	}

	ai_strategy = {
		type = befriend
		id = "ITA"
		value = 100
	}
	ai_strategy = {
		type = alliance
		id = "ITA"
		value = 100
	}
}

japan_ally = {
	allowed = {
		original_tag = GER
	}
	enable = {
		has_completed_focus = GER_japan_friend
		country_exists = JAP
	}
	abort = {
		NOT = { country_exists = JAP }
	}

	ai_strategy = {
		type = befriend
		id = "JAP"
		value = 200
	}
	ai_strategy = {
		type = alliance
		id = "JAP"
		value = 200
	}
}

china_ally = {
	allowed = {
		original_tag = GER
	}
	enable = {
		has_completed_focus = GER_china_friend
		country_exists = CHI
	}
	abort = {
		NOT = { country_exists = CHI }
	}

	ai_strategy = {
		type = befriend
		id = "CHI"
		value = 200
	}
	ai_strategy = {
		type = alliance
		id = "CHI"
		value = 200
	}
}

turkey_ally = {
	allowed = {
		original_tag = GER
	}
	enable = {
		has_completed_focus = GER_turkey_friend
		country_exists = TUR
	}
	abort = {
		NOT = { country_exists = TUR }
	}

	ai_strategy = {
		type = befriend
		id = "TUR"
		value = 100
	}
	ai_strategy = {
		type = alliance
		id = "TUR"
		value = 100
	}
}

spain_ally = {
	allowed = {
		NOT = { has_dlc = "La Resistance" }
		original_tag = GER
	}
	enable = {
		has_completed_focus = GER_nationalist_spain_ally
		country_exists = SPR
		SPR = { has_government = fascism } # TODO Find way to detect dynamic revolter tag
	}
	abort = {
		NOT = { country_exists = SPR }
	}

	ai_strategy = {
		type = befriend
		id = "SPR"
		value = 100
	}
	ai_strategy = {
		type = alliance
		id = "SPR"
		value = 100
	}
}

spain_ally_resistance = {
	allowed = {
		original_tag = GER
		has_dlc = "La Resistance"
	}
	enable = {
		has_completed_focus = GER_nationalist_spain_ally
		country_exists = SPA
	}
	abort = {
		OR = {
			NOT = { country_exists = SPA }
			SPA = { has_completed_focus = SPA_join_the_allies }
		}
	}

	ai_strategy = {
		type = befriend
		id = "SPA"
		value = 100
	}
	ai_strategy = {
		type = alliance
		id = "SPA"
		value = 100
	}
}

denmark_ally = {
	allowed = {
		original_tag = GER
	}
	enable = {
		has_completed_focus = GER_denmark_friend
		country_exists = DEN
	}
	abort = {
		NOT = { country_exists = DEN }
	}

	ai_strategy = {
		type = befriend
		id = "DEN"
		value = 100
	}
	ai_strategy = {
		type = alliance
		id = "DEN"
		value = 100
	}
}

sweden_ally = {
	allowed = {
		original_tag = GER
	}
	enable = {
		has_completed_focus = GER_sweden_friend
		country_exists = SWE
	}
	abort = {
		NOT = { country_exists = SWE }
	}

	ai_strategy = {
		type = befriend
		id = "SWE"
		value = 100
	}
	ai_strategy = {
		type = alliance
		id = "SWE"
		value = 100
	}
}

dutch_ally = {
	allowed = {
		original_tag = GER
	}
	enable = {
		has_completed_focus = GER_dutch_friend
		country_exists = HOL
	}
	abort = {
		NOT = { country_exists = HOL }
	}

	ai_strategy = {
		type = befriend
		id = "HOL"
		value = 100
	}
	ai_strategy = {
		type = alliance
		id = "HOL"
		value = 100
	}
}

norway_ally = {
	allowed = {
		original_tag = GER
	}
	enable = {
		has_completed_focus = GER_norway_friend
		country_exists = NOR
	}
	abort = {
		NOT = { country_exists = NOR }
	}

	ai_strategy = {
		type = befriend
		id = "NOR"
		value = 100
	}
	ai_strategy = {
		type = alliance
		id = "NOR"
		value = 100
	}
}

anschluss_rejected = {
	allowed = {
		original_tag = GER
	}
	enable = {
		has_completed_focus = GER_anschluss
		country_exists = AUS
	}
	abort = {
		NOT = {
			country_exists = AUS
		}
	}

	ai_strategy = {
		type = antagonize
		id = "AUS"
		value = 300
	}
}

CZE_is_idiot = {
	allowed = {
		original_tag = GER
	}
	enable = {
		has_global_flag = CZE_refused_sudetenland
		country_exists = CZE
	}
	abort = {
		NOT = {
			country_exists = CZE
		}
	}

	ai_strategy = {
		type = antagonize
		id = "CZE"
		value = 300
	}
}

play_nice_with_ribbentrop_pact = {
	allowed = {
		original_tag = GER
	}
	enable = {
		has_global_flag = sov_yes_pact
	}
	abort = {
		OR ={
			GER = { has_war_with = SOV }
			date > 1941.5.1
			AND = {
				LIT = { is_in_faction_with = SOV }
				LAT = { is_in_faction_with = SOV }
				EST = { is_in_faction_with = SOV }
			}
		}
	}

	# leave britney alone!
	ai_strategy = {
		type = ignore
		id = "LIT"
		value = 100
	}
	ai_strategy = {
		type = ignore
		id = "LAT"
		value = 100
	}
	ai_strategy = {
		type = ignore
		id = "EST"
		value = 100
	}
}

tfv_protect_fascist_south_africa = {
	allowed = {
		original_tag = GER
	}
	enable = {
		has_country_flag = saf_fascist_uprising # Set from the national focus
	}
	abort = {
		surrender_progress > 0.8
		SAF = { has_civil_war = no }
	}

	ai_strategy = {
		type = protect
		id = "SAF"
		value = 200
	}
	ai_strategy = {
		type = send_volunteers_desire
		id = "SAF"
		value = 200
	}
	ai_strategy = {
		type = support
		id = "SAF"
		value = 200
	}
	ai_strategy = {
		type = alliance
		id = "SAF"
		value = 200
	}
}

less_naval_focused_nation = {
	allowed = {
		original_tag = GER
		not = {
			has_dlc = "Man the Guns"
		}
	}
	enable = {
		date > "1936.1.1" #Don't Germany, just dont
	}
	abort = {
		date > "1943.1.1" #Don't Germany, just dont, if you haven't already won
	}

	ai_strategy = {
		type = unit_ratio
		id = capital_ship
		value = -3
	}

	ai_strategy = {
		type = unit_ratio
		id = submarine
		value = -3
	}

	ai_strategy = {
		type = unit_ratio
		id = screen_ship
		value = -3
	}

	ai_strategy = {
		type = unit_ratio
		id = convoy
		value = -3
	}
}

GER_naval_role_ratios_historical = {
	allowed = {
		original_tag = GER
		has_dlc = "Man the Guns"
	}
	enable = {
		not = { GER_naval_interest_trigger = yes }
	}

	ai_strategy = {
		type = role_ratio
		id = naval_capital_bb
		value = -25
	}

	ai_strategy = {
		type = role_ratio
		id = naval_capital_bc
		value = -100
	}

	ai_strategy = {
		type = role_ratio
		id = naval_carrier
		value = -50
	}

	ai_strategy = {
		type = role_ratio
		id = naval_submarine
		value = 200
	}
	ai_strategy = {
		type = role_ratio
		id = submarine
		value = 200
	}

	ai_strategy = {
		type = role_ratio
		id = naval_screen
		value = 100
	}

	ai_strategy = {
		type = role_ratio
		id = naval_cruiser_light
		value = 50
	}

	ai_strategy = {
		type = role_ratio
		id = naval_cruiser_heavy
		value = 5
	}

	ai_strategy = {
		type = role_ratio
		id = naval_mine_sweeper
		value = 15
	}

	ai_strategy = {
		type = role_ratio
		id = naval_mine_layer
		value = 10
	}
}

GER_naval_role_ratios_ahistorical = {
	allowed = {
		original_tag = GER
		has_dlc = "Man the Guns"
	}
	enable = {
		GER_naval_interest_trigger = yes
	}

	ai_strategy = {
		type = role_ratio
		id = naval_capital_bb
		value = -10
	}

	ai_strategy = {
		type = role_ratio
		id = naval_capital_bc
		value = 0
	}

	ai_strategy = {
		type = role_ratio
		id = naval_carrier
		value = 50
	}

	ai_strategy = {
		type = role_ratio
		id = naval_submarine
		value = 150
	}

	ai_strategy = {
		type = role_ratio
		id = naval_screen
		value = 120
	}

	ai_strategy = {
		type = role_ratio
		id = naval_cruiser_light
		value = 35
	}

	ai_strategy = {
		type = role_ratio
		id = naval_cruiser_heavy
		value = 5
	}

	ai_strategy = {
		type = role_ratio
		id = naval_mine_sweeper
		value = 15
	}

	ai_strategy = {
		type = role_ratio
		id = naval_mine_layer
		value = 10
	}
}

GER_naval_role_ratios_maximum_kaiser = {
	allowed = {
		original_tag = GER
		has_dlc = "Man the Guns"
	}
	enable = {
		has_completed_focus = GER_rebuild_the_high_seas_fleet
	}

	ai_strategy = {
		type = role_ratio
		id = naval_capital_bb
		value = -5
	}

	ai_strategy = {
		type = role_ratio
		id = naval_capital_bc
		value = -20
	}

	ai_strategy = {
		type = role_ratio
		id = naval_carrier
		value = 25
	}

	ai_strategy = {
		type = role_ratio
		id = naval_submarine
		value = 50
	}

	ai_strategy = {
		type = role_ratio
		id = naval_screen
		value = 120
	}

	ai_strategy = {
		type = role_ratio
		id = naval_cruiser_light
		value = 75
	}

	ai_strategy = {
		type = role_ratio
		id = naval_cruiser_heavy
		value = 50
	}

	ai_strategy = {
		type = role_ratio
		id = naval_mine_sweeper
		value = 15
	}

	ai_strategy = {
		type = role_ratio
		id = naval_mine_layer
		value = 10
	}
}

GER_area_priority = {
	allowed = {
		original_tag = GER
	}
	enable = {
		always = yes
	}

	ai_strategy = {
		type = area_priority
		id = europe
		value = 110 #more focus here
	}

	ai_strategy = {
		type = area_priority
		id = scandinavia
		value = 80
	}

	ai_strategy = {
		type = area_priority
		id = north_america
		value = 90
	}

	ai_strategy = {
		type = area_priority
		id = south_america
		value = 75
	}

	ai_strategy = {
		type = area_priority
		id = asia
		value = 75
	}

	ai_strategy = {
		type = area_priority
		id = middle_east
		value = 50
	}
	ai_strategy = {
		type = area_priority
		id = suez
		value = 30
	}

	ai_strategy = {
		type = area_priority
		id = africa
		value = -70
	}

	ai_strategy = {
		type = area_priority
		id = pacific
		value = -120 #less focus here
	}

	ai_strategy = {
		type = area_priority
		id = oceania
		value = -80
	}
}

invading_france_is_pointless_because_we_go_through_benelux_soon = {
	allowed = {
		original_tag = GER
	}
	enable = {
		if = {
			limit = { NOT = { has_dlc = "Man the Guns" } }
			NOT = { has_tech = landing_craft }
		}
		else = {
			NOT = { has_tech = mtg_landing_craft }
		}
		date < 1940.1.1
	}
	abort = {
		OR = {
			has_tech = landing_craft
			has_tech = mtg_landing_craft
			date > 1940.1.1
		}
	}

	ai_strategy = {
		type = invade
		id = "FRA"
		value = -2000 # that low means not going for islands either
	}

	# danzig corridor is too small to be worth opening extra invasion front
	ai_strategy = {
		type = invade
		id = "POL"
		value = -500
	}
}

worry_about_barbarossa_before_africa = {
	allowed = {
		original_tag = GER
	}
	enable = {
		country_exists = SOV
		NOT = {	is_in_faction_with = SOV }
		has_war_with = ENG
		ENG = { is_ai = yes }
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = area_priority
		id = middle_east
		value = -30
	}
	ai_strategy = {
		type = area_priority
		id = suez
		value = -30
	}
}

make_sure_poland_is_ganked_before_we_move = {
	allowed = {
		original_tag = GER
	}
	enable = {
		has_war_with = POL
		POL = { has_capitulated = no }
		date < 1940.1.1
	}
	abort = {
		OR = {
			POL = { has_capitulated = yes }
			date > 1940.1.1
		}
	}

	ai_strategy = {
		type = declare_war
		id = "HOL"
		value = -2000
	}
	ai_strategy = {
		type = declare_war
		id = "BEL"
		value = -2000
	}
	ai_strategy = {
		type = declare_war
		id = "LUX"
		value = -2000
	}
}

GER_want_to_invade_FRA_without_ITA = {
	allowed = {
		original_tag = GER
	}
	enable = {
		is_historical_focus_on = yes
		date < 1940.1.1
		FRA = {
			is_ai = yes
		}
		HOL = {	has_capitulated = no }
		BEL = {	has_capitulated = no }
	}

	abort = {
		OR = {
			date > 1940.1.1
			FRA = {
				is_ai = no
			}
			AND = {
				HOL = {	has_capitulated = yes }
				BEL = {	has_capitulated = yes }
			}
		}
	}

	ai_strategy = {
		type = dont_join_wars_with
		id = ITA
		target_country = FRA
		value = 500
	}
}

axis_stay_away_from_the_royal_navy = {
	enable = {
		has_war_with = ENG
		date < 1942.1.1

		OR = {
			GER = {
				naval_strength_ratio = {
					tag = ENG
  					ratio < 0.5
  				}
  			}

			# if we manage to get a foothold in UK we must do what we can to exploit it! (checks coastal states)
			divisions_in_state = { state = 127 size < 1 }
			divisions_in_state = { state = 126 size < 1 }
			divisions_in_state = { state = 125 size < 1 }
			divisions_in_state = { state = 129 size < 1 }
			divisions_in_state = { state = 130 size < 1 }
			divisions_in_state = { state = 131 size < 1 }
			divisions_in_state = { state = 123 size < 1 }
			divisions_in_state = { state = 122 size < 1 }
			divisions_in_state = { state = 132 size < 1 }
			divisions_in_state = { state = 121 size < 1 }
			divisions_in_state = { state = 136 size < 1 }
			divisions_in_state = { state = 120 size < 1 }
			divisions_in_state = { state = 133 size < 1 }
		}
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = naval_avoid_region
		id = 18 #english channel
		value = 600 # avoid doing missions as well
	}
	ai_strategy = {
		type = naval_avoid_region
		id = 16 #around UK
		value = 100
	}
	ai_strategy = {
		type = naval_avoid_region
		id = 43 #around UK
		value = 100
	}
}

dont_take_claims_on_POL_we_got_focus = {
	allowed = {
		original_tag = GER
	}
	enable = {
		country_exists = POL
		has_war = no
		has_completed_focus = GER_demand_memel
	}

	abort = {
		OR = {
			NOT = { country_exists = POL }
			date > 1940.1.1
			has_war = yes
		}
	}

	ai_strategy = {
		type = ignore_claim
		id = "POL"
		value = 1
	}
}

axis_dont_mess_with_volunteers = {
	allowed = {
		OR = {
			original_tag = GER
			original_tag = ITA
		}
	}
	enable = {
		date < 1941.6.1
	}
	abort = {
		date > 1941.6.1
	}

	ai_strategy = {
		type = send_volunteers_desire
		id = JAP
		value = -500
	}

	ai_strategy = {
		type = send_volunteers_desire
		id = CHI
		value = -500 #sorry buds
	}

	ai_strategy = {
		type = send_volunteers_desire
		id = MAN
		value = -500
	}
}

GER_industry_we_are_the_baddies = {
	allowed = {
		original_tag = GER
	}
	enable = {
		date > 1937.8.1
	}
	abort={
		date > 1940.1.1
	}

	ai_strategy = {
		type = added_military_to_civilian_factory_ratio
		value = 50
	}
	ai_strategy = {
		type = air_factory_balance
		value = 100
	}
}

GER_industry_we_are_the_baddies_2 = {
	allowed = {
		original_tag = GER
	}
	enable = {
		date > 1940.1.1
	}

	ai_strategy = {
		type = added_military_to_civilian_factory_ratio
		value = 20
	}
}

GER_industry_we_are_the_baddies_but_not_yet = {
	allowed = {
		original_tag = GER
	}
	enable = {
		date < 1937.8.1
	}
	abort={
		date > 1937.8.1
	}

	ai_strategy = {
		type = air_factory_balance
		value = 110
	}
	ai_strategy = {
		type = role_ratio
		id = armor
		value = -50 #because doctrine this = 3
	}
}

Axis_care_less_about_making_friends = {

	enable = {
		has_government = fascism
		is_in_faction = yes
		manpower_per_military_factory < 3000
		has_war = yes
	}
	abort = {
		OR = {
			NOT = { has_government = fascism }
			is_in_faction = no
			manpower_per_military_factory > 3000
			has_war = no
		}
	}

	ai_strategy = {
		type = pp_spend_priority
		id = relation
		value = -9999
	}
}

GER_wants_civ = {
	allowed = {
		original_tag = GER
	}
	enable = {
		has_government = fascism
		date < 1937.9.15
		has_war = no
	}
	abort_when_not_enabled = yes
	ai_strategy = {
		type = building_target
		id = industrial_complex
		value = 59
	}
}
GER_wants_synth = {
	allowed = {
		original_tag = GER
	}
	enable = {
		has_government = fascism
		date > 1937.10.20
		has_war = no
	}
	abort_when_not_enabled = yes
	ai_strategy = {
		type = building_target
		id = synthetic_refinery
		value = 8
	}
}

GER_share_borders_with_ITA_against_SOV = {
	allowed = {
		original_tag = GER
	}
	enable = {
		is_in_faction_with = ITA
		going_war_with_SOV = yes

		GER_should_split_SOV_front_with_ITA = yes
	}
	abort = {
		not = {
			is_in_faction_with = ITA
			going_war_with_SOV = yes
			GER_should_continue_split_SOV_front_with_ITA = yes
		}
	}

	ai_strategy = {
		type = dont_defend_ally_borders
		id = "CRO"
		value = 100
	}
	ai_strategy = {
		type = dont_defend_ally_borders
		id = "ROM"
		value = 100
	}
	ai_strategy = {
		type = dont_defend_ally_borders
		id = "HUN"
		value = 100
	}
	ai_strategy = {
		type = dont_defend_ally_borders
		id = "SLO"
		value = 100
	}
	ai_strategy = {
		type = dont_defend_ally_borders
		id = "ITA"
		value = 100
	}
}

GER_we_dont_fight_pathetic_sweden = { # :O
	allowed = {
		original_tag = GER
	}
	enable = {
		is_historical_focus_on = no
		has_government = fascism
		SWE = {
			has_idea = neutrality_idea
		}
	}
	abort = {
		SWE = {
			not = { has_idea = neutrality_idea }
		}
	}
	ai_strategy = {
		type = antagonize
		id = SWE
		value = -200 #keep the iron coming and no one gets hurt
	}
	ai_strategy = {
		type = protect
		id = SWE
		value = 100 #keep the iron coming and no one gets hurt
	}
}

GER_we_dont_fight_pathetic_sweden_on_historical = { # :O
	allowed = {
		original_tag = GER
	}
	enable = {
		is_historical_focus_on = yes
		has_government = fascism
		SWE = {
			has_idea = neutrality_idea
		}
	}
	abort = {
		SWE = {
			not = { has_idea = neutrality_idea }
		}
	}
	ai_strategy = {
		type = antagonize
		id = SWE
		value = -50 #keep the iron coming and no one gets hurt
	}
	ai_strategy = {
		type = protect
		id = SWE
		value = 50 #keep the iron coming and no one gets hurt
	}
}

spain_scw_support_GER_resistance = {
	allowed = {
		original_tag = GER
		has_dlc = "La Resistance"
	}
	enable = {
		has_government = fascism
		country_exists = SPA
	}
	abort = {
		OR = {
			NOT = { country_exists = SPA }
			SPA = { has_completed_focus = SPA_join_the_allies }
		}
	}

	ai_strategy = {
		type = support
		id = "SPA"
		value = 100
	}
	ai_strategy = {
		type = send_volunteers_desire
		id = "SPA"
		value = 100
	}
}

GER_we_are_bad_at_espionage_because_it_is_expensive_and_not_tanks = {
	allowed = {
		original_tag = GER
		has_dlc = "La Resistance"
	}
	enable = {
		has_government = fascism
		num_of_civilian_factories < 90
		num_of_civilian_factories > 30
	}
	abort = {
		OR = {
			num_of_civilian_factories > 90
		}
	}
	ai_strategy = {
		type = intelligence_agency_usable_factories
		value = -20
	}
}

GER_my_precisioussss = {
	allowed = {
		original_tag = GER
	}

	enable = {
		OR = {
			date < 1944.6.1
			has_war = yes
		}
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = send_lend_lease_desire
		id = SLO
		value = -999
	}
	ai_strategy = {
		type = send_lend_lease_desire
		id = MAN
		value = -999
	}
	ai_strategy = {
		type = send_lend_lease_desire
		id = CHI
		value = -999
	}
	ai_strategy = {
		type = send_lend_lease_desire
		id = YUN
		value = -999
	}
	ai_strategy = {
		type = send_lend_lease_desire
		id = SHX
		value = -999
	}
	ai_strategy = {
		type = send_lend_lease_desire
		id = XSM
		value = -999
	}
	ai_strategy = {
		type = send_lend_lease_desire
		id = SIK
		value = -999
	}
}

GER_let_italy_handle_french_front_alone = {
	allowed = {
		original_tag = GER
	}
	enable = {
		is_in_faction_with = ITA
		OR = {
			AND = {
				has_war_together_with = ITA
				has_war_with = FRA
			}
			focus_progress = {
				focus = GER_danzig_or_war
				progress > 0.01
			}
		}
		date < 1940.8.1
	}
	abort_when_not_enabled = yes
	ai_strategy = {
		type = dont_defend_ally_borders
		id = "ITA"
		value = 100
	}
}


GER_ITA_close_up_maginot_line_after_FRA_falls  = {
	allowed = {
		OR = {
			original_tag = GER
			original_tag = FRA
		}
	}

	enable = {
		date < 1941.3.3
		has_war_with = FRA
		FRA = {
			has_capitulated = yes
			days_since_capitulated > 7 # let's give a week before things settle
			days_since_capitulated < 90
		}
		NOT = { has_full_control_of_state = 28 }
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = front_control

		state = 28 # close up maginot line

		ratio = 0.6

		priority = 100
		ordertype = front
		execution_type = rush
		execute_order = yes
	}

	ai_strategy = {
		type = front_unit_request

		state = 28

		value = 50 # lets put more units, should be safe
	}
}


# AI are not willing to invade if it is at war at its home against another country's home location
# lets force invade NOR for GER & ITA
GER_enable_invasion_of_NOR = {
	allowed = {
		OR = {
			original_tag = GER
			original_tag = ITA
		}
	}
	enable = {
		# try to invade NOR if things are looking not so bad
		OR = {
			date < 1940.4.4
			FRA = { has_capitulated = yes } # uh oh, maybe we need more units against FRA
		}
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = invade
		id = "NOR"
		value = 10
	}
}


# focus armor units on low countries
# and ignore mighty lux until they fall
GER_around_the_maginot = {
	allowed = {
		original_tag = GER
		is_historical_focus_on = yes
	}

	enable = {
		date < 1941.4.1
		FRA = {
			is_ai = yes
		}

		#uh oh, they are pushing
		42 = {
			is_controlled_by = GER
		}
		50 = {
			is_controlled_by = GER
		}

		# both low countries fell
		OR = {
			HOL = {
				has_capitulated = no
			}
			BEL = {
				has_capitulated = no
			}
		}

		# lux somehow joined the fun
		NOT = { has_war_with = LUX }
		LUX = {
			has_capitulated = no
			NOT = { is_in_faction_with = FRA }
		}

		# we are ready to declare war on low countries
		OR = {
			focus_progress = {
				focus = GER_around_maginot
				progress > 0
			}
			AND = {
				is_in_array = { potential_and_current_enemies = HOL }
				is_in_array = { potential_and_current_enemies = BEL }
			}
		}
		is_in_array = { potential_and_current_enemies = FRA }
	}

	abort_when_not_enabled = yes

	# leave LUX for later
	ai_strategy = {
		type = declare_war
		id = "LUX"
		value = -2000
	}

	ai_strategy = {
		type = diplo_action_desire
		id = "LUX"
		target = declare_war
		value = -50000
	}

	ai_strategy = {
		type = front_armor_score
		id = "FRA"
		value = -100
	}

	ai_strategy = {
		type = front_armor_score
		id = "HOL"
		value = 100
	}

	ai_strategy = {
		type = front_armor_score
		id = "BEL"
		value = 100
	}

	ai_strategy = {
		type = front_armor_score
		id = "POL"
		value = 100
	}
}


# lets not invade until we have europe
GER_dont_invade_until_FRA_falls = {
	allowed = {
		original_tag = GER
		is_historical_focus_on = yes
	}

	enable = {
		date < 1941.3.1
		FRA = {
			has_capitulated = no
		}
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = invasion_unit_request
		country_trigger = { always = yes }

		value = -100
	}

	ai_strategy = {
		type = front_unit_request

		# norway
		state = 110
		state = 142
		state = 143
		state = 144

		value = -100
	}
}

GER_have_some_train_production = {
	allowed = {
		original_tag = GER
	}

	enable = {
		date > 1936.7.1
		num_of_military_factories > 50
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = equipment_production_min_factories # This does not seem to work
		id = train
		value = 3
	}
}

GER_stock_up_on_trains_before_poland = { #but this does work
	allowed = {
		original_tag = GER
	}

	enable = {
		date > 1938.7.1
		date < 1940.7.1
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = min_wanted_supply_trains
		value = 180
	}
}

GER_stock_up_on_trains_before_barbarossa = {
	allowed = {
		original_tag = GER
	}

	enable = {
		date > 1940.7.1
		date < 1943.1.1
		has_war = yes
	}
	abort = {
		has_war_with = SOV # Barbarossa has started, let wartime prioritization do its thing
		date > 1943.1.1
	}

	ai_strategy = {
		type = min_wanted_supply_trains
		value = 600
	}
}

GER_xp_upgrade_spending_land = {
	allowed = {
		original_tag = GER
	}

	enable = {
		date < 1941.6.1
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = land_xp_spend_priority
		id = upgrade_xp_cutoff
		value = 100
	}
}

GER_vichy_has_served_its_purpose = {
	allowed = {
		original_tag = GER
	}

	enable = {
		country_exists = VIC
		VIC = {
			OR = {
				has_country_flag = case_anton # Germany has activated the decision

				count_triggers = { # Conditions for decision GER_case_anton
					amount = 3 # lost control of ca half french north africa
					458 = { CONTROLLER = { has_war_with = ROOT } }
					459 = { CONTROLLER = { has_war_with = ROOT } }
					460 = { CONTROLLER = { has_war_with = ROOT } }
					461 = { CONTROLLER = { has_war_with = ROOT } }
					462 = { CONTROLLER = { has_war_with = ROOT } }
					513 = { CONTROLLER = { has_war_with = ROOT } }
					665 = { CONTROLLER = { has_war_with = ROOT } }
				}
			}
		}
	}

	ai_strategy = {
		type = prepare_for_war
		id = VIC
		value = 100
	}
}

GER_dont_upgrade_to_weapons_3_too_early = {
	allowed = {
		original_tag = GER
	}
	enable = {
		is_historical_focus_on = yes
		has_equipment = { infantry_equipment < 60000 }
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = production_upgrade_desire_offset
		id = infantry_equipment_3
		value = -100
	}
}

GER_blitzkrieg_benelux  = {
	allowed = {
		original_tag = GER
	}

	enable = {
		date < 1940.2.1 #Don't keep pushing wildly if we haven't capitulated benelux in 4 months - we lost anyway
		OR = {
			AND = {
				focus_progress = {
					focus = GER_around_maginot
					progress > 0.01
				}
				NOT = { has_war_with = HOL  }
			}
			AND = {
				has_war_with = HOL
				HOL = { has_capitulated = no }
			}
			AND = {
				has_war_with = BEL
				BEL = { has_capitulated = no }
			}
		}
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = front_control

		tag = HOL

		ratio = 0.25

		priority = 100
		ordertype = front
		execution_type = rush
		execute_order = yes
	}

	ai_strategy = {
		type = front_control

		tag = BEL

		ratio = 0.25

		priority = 100
		ordertype = front
		execution_type = rush
		execute_order = yes
	}

	ai_strategy = {
		type = front_unit_request

		tag = BEL

		value = 50 # lets put more units, should be safe
	}

	ai_strategy = {
		type = front_unit_request

		tag = HOL

		value = 50 # lets put more units, should be safe
	}
}

GER_blitzkrieg_russia  = { #Rolling incursions
	allowed = {
		original_tag = GER
	}

	enable = {
		#always = no #This isn't great
		date < 1942.4.1 #To space!
		date > 1941.10.10
		has_war_with = SOV
		OR = {
			has_idea = GER_barbarossa
			SOV = { has_idea = SOV_desperate_measures_ns }
		}
		has_equipment = { infantry_equipment > 15000 } #WE NEED GUNS
		set_temp_variable = { days = global.num_days }
		modulo_temp_variable = { days = 40 }
		check_variable = { days < 20 }
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = front_control

		tag = SOV

		ratio = 0.5

		priority = 100
		ordertype = front
		execution_type = rush_weak
		execute_order = yes
	}

}

GER_normandy_buffer = {
	allowed = {
		original_tag = GER
	}
	enable = {
		is_historical_focus_on = yes
		FRA = {
			has_capitulated = yes
		}
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = put_unit_buffers
		states = {
			42
			51
			55
			57
		}
		ratio = 0.07
		area = normandy_landing_zone
		subtract_invasions_from_need = no
		subtract_fronts_from_need = yes
	}
}

GER_push_back_our_coasts_until_overlord  = {
	allowed = {
		original_tag = GER
	}

	enable = {
		date < 1943.6.6
		is_historical_focus_on = yes
		FRA = { has_capitulated = yes }
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = front_control

		tag = HOL

		ratio = 0.25

		priority = 100
		ordertype = front
		execution_type = balanced
		execute_order = yes
	}

	ai_strategy = {
		type = front_control

		tag = BEL

		ratio = 0.25

		priority = 100
		ordertype = front
		execution_type = balanced
		execute_order = yes
	}

	ai_strategy = {
		type = front_control

		tag = FRA

		ratio = 0.25

		priority = 100
		ordertype = front
		execution_type = balanced
		execute_order = yes
	}

	ai_strategy = {
		type = front_unit_request

		tag = BEL

		value = 25
	}

	ai_strategy = {
		type = front_unit_request

		tag = HOL

		value = 25 # lets put more units, should be safe
	}

	ai_strategy = {
		type = front_unit_request

		tag = FRA

		value = 25
	}
}

GER_pause_in_SOV = { #We got this far but our home is under siege
	allowed = {
		original_tag = GER
	}

	enable = {
		date > 1943.1.1
		is_historical_focus_on = yes
		SOV = { has_capitulated = no }
		surrender_progress > 0.25
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = front_control

		tag = SOV

		ratio = 0.75

		priority = 100
		ordertype = front
		execution_type = careful
		execute_order = no
	}
}
